﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WeMakeSP.WebComponents.RSSAdvancedReaderWebPart
{
    /// <summary>
    /// The event arguments for feed item refresh events.
    /// </summary>
    public class FeedItemRefreshEventArgs : EventArgs
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="FeedItemRefreshEventArgs"/> class.
        /// </summary>
        /// <param name="feedUrl">The feed URL.</param>
        /// <param name="feedItem">The feed item.</param>
        public FeedItemRefreshEventArgs(string feedUrl, string feedItem)
            : this(feedUrl, feedItem, 0)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FeedItemRefreshEventArgs"/> class.
        /// </summary>
        /// <param name="feedUrl">The feed URL.</param>
        /// <param name="feedItem">The feed item.</param>
        /// <param name="itemCount">The item count.</param>
        public FeedItemRefreshEventArgs(string feedUrl, string feedItem, int itemCount)
        {
            // Guard.

            if (String.IsNullOrEmpty(feedUrl))
            {
                throw new ArgumentNullException("feedUrl");
            }

            if (String.IsNullOrEmpty(feedItem))
            {
                throw new ArgumentNullException("feedItem");
            }

            if (itemCount < 0)
            {
                throw new ArgumentOutOfRangeException("itemCount");
            }

            this.FeedUrl = feedUrl;
            this.FeedItem = feedItem;
            this.ItemCount = itemCount;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the item count.
        /// </summary>
        /// <value>The item count.</value>
        public int ItemCount
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the feed item.
        /// </summary>
        /// <value>The feed item.</value>
        public string FeedItem
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the feed URL.
        /// </summary>
        /// <value>The feed URL.</value>
        public string FeedUrl
        {
            get;
            private set;
        }

        #endregion
    }
}
